<?php
class Admin_Form_Search_Cruise extends Apps_Plugin_Grid_Search_Abstract {
    public function preInit() {
        $dMapper 			= new M_Tool_DataMapper();
        $cruiseCategoryList = $dMapper->mapKeyValue(new M_DbTable_CruiseCategory(), 'id', 'title');
        $cruiseTypeList = $dMapper->mapKeyValue(new M_DbTable_CruiseType(), 'id', 'title');

        $advancedCriteria = array(
            'name' => array(
                    'c.name',
                    self::$criteriaStringLike,
                    array(
                            'element'  => self::ELEMENT_TEXT,
                            'label'    => 'Tên du thuyền(Vi)',
                    )
            ),
            'en-name' => array(
                    'c.en_name',
                    self::$criteriaStringLike,
                    array(
                            'element'  => self::ELEMENT_TEXT,
                            'label'    => 'Tên du thuyền(En)',
                    )
            ),
            'category' => array(
            		'c.cruise_category_id',
            		self::$criteriaSimple,
					array(
							'element'	   => self::ELEMENT_SELECT,
							'label'		   => 'Danh mục',
							'multiOptions' => $cruiseCategoryList
					)
            ),
            'type' => array(
            		'c.cruise_type_id',
            		self::$criteriaSimple,
					array(
							'element'	   => self::ELEMENT_SELECT,
							'label'		   => 'Loại',
							'multiOptions' => $cruiseTypeList
					)
            ),
//             'km' => array(
//             		'c.special_offer',
//             		self::$criteriaSimple,
// 					array(
// 							'element'	   => self::ELEMENT_SELECT,
// 							'label'		   => 'Khuyến mãi',
// 							'multiOptions' => array(M_DbTable_Cruise::SPECIAL_OFFER_TRUE 	=> 'Có',
// 													M_DbTable_Cruise::SPECIAL_OFFER_FALSE => 'Không')
// 					)
//             )
        );

        $simpleCriteria = array(
        		array('c.name LIKE ?', '%%%s%%'),
        		array('c.en_name LIKE ?', '%%%s%%'),
        		array('c_c.title LIKE ?', '%%%s%%'),
        		array('c_t.title LIKE ?', '%%%s%%'),
        );

        $this->setAdvCriteria($advancedCriteria);
        $this->setSplCriteria($simpleCriteria);
    }
}